package J20250227_dfs;
import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description: 作物杂交——https://www.lanqiao.cn/problems/506/learning/?page=2&first_category_id=1&tags=DFS&tag_relation=intersection
 * User: 王圆豪
 * Date: 2025-03-14
 * Time: 20:53
 */
public class Main6 {
    static long ret = 0;
    static int[] memo;
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int k = scan.nextInt();
        int t = scan.nextInt();
        int[] T = new int[n+1];
        memo = new int[n+1];
        for(int i = 1; i <= n; i++){
            T[i] = scan.nextInt();
            memo[i] = -1;
        }
        boolean[] start = new boolean[n+1];
        for(int i = 1; i <= m; i++){
            int v = scan.nextInt();
            start[v] = true;
            memo[v] = 0;
        }
        HashMap<Integer,List<List<Integer>>> map = new HashMap<>();
        for(int i = 0; i < k; i++){
            int a = scan.nextInt();
            int b = scan.nextInt();
            int c = scan.nextInt();
            if(!map.containsKey(c)) map.put(c, new ArrayList<>());
            List<Integer> l = new ArrayList<>();
            l.add(a);
            l.add(b);
            map.get(c).add(l);
        }
        System.out.print(dfs(t,map,T,start));
        scan.close();
    }

    static int dfs(int target, HashMap<Integer,List<List<Integer>>> map, int[] T, boolean[] start){
        // if(start[target]) return 0;
        if(memo[target] != -1) return memo[target];
        int cur = 0x3f3f3f3f;
        List<List<Integer>> tmp = map.get(target);
        for(List<Integer> l : tmp){
            int kpl = 0;
            int a = l.get(0);
            int b = l.get(1);
            kpl += Math.max(dfs(a,map,T,start),dfs(b,map,T,start));
            kpl += Math.max(T[a],T[b]);
            cur = Math.min(cur,kpl);
        }
        start[target] = true;
        memo[target] = cur;
        return cur;
    }
}
